/**
 * SD-LoRA校园图片生成系统 - 聊天界面样式
 */

/* 思考中状态 */
.thinking {
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 8px 0;
    padding: 5px 0;
    justify-content: flex-start; /* 左对齐 */
    max-width: 100px; /* 缩短宽度 */
}

.thinking span {
    width: 6px; /* 减小点的大小 */
    height: 6px;
    background-color: #1a73e8;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
    opacity: 0.7;
}

.thinking span:nth-child(1) {
    animation-delay: 0s;
}

.thinking span:nth-child(2) {
    animation-delay: 0.2s;
}

.thinking span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {
    0%, 80%, 100% { 
        transform: scale(0.6);
        opacity: 0.6;
    }
    40% { 
        transform: scale(1);
        opacity: 1;
    }
}

/* 参数摘要样式 */
.params-summary {
    background-color: #f0f7ff;
    border-left: 3px solid #1a73e8;
    padding: 12px 16px;
    margin: 15px 0;
    font-size: 0.9rem;
    border-radius: 0 8px 8px 0;
    color: #555;
    line-height: 1.6;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.params-summary h4 {
    font-weight: 500;
    margin-bottom: 8px;
    color: #1a73e8;
}

.params-summary ul {
    margin: 8px 0 8px 20px;
    padding: 0;
}

.params-summary li {
    margin-bottom: 5px;
}

/* 代码块 */
pre {
    background-color: #f5f5f5;
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    margin: 15px 0;
    border: 1px solid #e0e0e0;
    font-size: 0.9rem;
    line-height: 1.5;
}

code {
    font-family: 'Menlo', 'Monaco', 'Courier New', monospace;
    background-color: #f0f0f0;
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 0.9em;
    color: #e91e63;
}

/* 错误消息 */
.error-message {
    color: #d32f2f;
    background-color: #ffebee;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 15px 0;
    border-left: 4px solid #d32f2f;
    font-size: 0.95rem;
    line-height: 1.6;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.error-message .error-title {
    font-weight: 600;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
}

.error-message .error-title::before {
    content: "⚠️";
    margin-right: 8px;
    font-size: 1.1rem;
}

.error-message .retry-btn {
    display: inline-block;
    margin-top: 10px;
    background-color: #f44336;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background-color 0.2s;
}

.error-message .retry-btn:hover {
    background-color: #d32f2f;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* 消息引用 */
blockquote {
    border-left: 3px solid #1a73e8;
    margin: 10px 0;
    padding: 10px 15px;
    background-color: #f5f9ff;
    color: #333;
    font-style: italic;
    border-radius: 0 5px 5px 0;
}

/* 无历史记录时的提示 */
.empty-history {
    color: #757575;
    font-style: italic;
    padding: 15px;
    text-align: center;
    background-color: #f9f9f9;
    border-radius: 8px;
    margin: 10px 0;
}

/* 高亮文本 */
.highlight {
    background-color: rgba(26, 115, 232, 0.1);
    color: #1a73e8;
    padding: 0 3px;
    border-radius: 3px;
}

/* 流式响应中的闪烁光标 */
.typing-cursor {
    display: inline-block;
    width: 2px;
    height: 15px;
    background-color: #1a73e8;
    margin-left: 2px;
    animation: blink 1s infinite;
    vertical-align: middle;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* 语法高亮 */
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
    color: #708090;
}

.token.punctuation {
    color: #999;
}

.token.property,
.token.tag,
.token.constant,
.token.symbol,
.token.deleted {
    color: #905;
}

.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
    color: #690;
}

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
    color: #9a6e3a;
}

.token.atrule,
.token.attr-value,
.token.keyword {
    color: #07a;
}

.token.function,
.token.class-name {
    color: #dd4a68;
}

.token.regex,
.token.important,
.token.variable {
    color: #e90;
}

.token.important,
.token.bold {
    font-weight: bold;
}

.token.italic {
    font-style: italic;
}

/* 按钮组 */
.button-group {
    display: flex;
    gap: 10px;
    margin: 15px 0;
}

.button-group button {
    padding: 8px 15px;
    border-radius: 6px;
    border: none;
    background-color: #f5f5f5;
    color: #333;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.button-group button:hover {
    background-color: #e0e0e0;
}

.button-group button.primary {
    background-color: #1a73e8;
    color: white;
}

.button-group button.primary:hover {
    background-color: #1565c0;
}

/* 参数调整面板 */
.params-panel {
    background-color: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
}

.params-panel h4 {
    font-weight: 500;
    margin-bottom: 15px;
    color: #333;
}

.params-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.param-item {
    display: flex;
    flex-direction: column;
}

.param-item label {
    font-size: 0.9rem;
    margin-bottom: 5px;
    color: #555;
}

.param-item input, 
.param-item select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
}

.param-item input:focus, 
.param-item select:focus {
    border-color: #1a73e8;
    outline: none;
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
}

/* 响应式调整 */
@media screen and (max-width: 768px) {
    .params-group {
        grid-template-columns: 1fr;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    pre {
        font-size: 0.8rem;
        padding: 10px;
    }
}

/* 提示词建议列表 */
.prompt-suggestions {
    position: absolute;
    bottom: 100%;
    left: 0;
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
    background-color: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 10;
    display: none;
}

.suggestion-item {
    padding: 10px 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background-color 0.2s;
}

.suggestion-item:hover {
    background-color: #f5f9ff;
}

.suggestion-tag {
    background-color: #e8f0fe;
    color: #1a73e8;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    margin-right: 10px;
    white-space: nowrap;
}

.suggestion-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 输入区域相对定位，以便正确放置提示词列表 */
.input-area {
    position: relative;
}

/* 推理内容样式 */
.reasoning-box {
    margin-top: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    max-width: 100%; /* 限制最大宽度 */
}

.reasoning-title {
    padding: 10px 15px;
    background-color: #f5f9ff;
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    color: #1a73e8;
}

.reasoning-title i {
    margin-right: 8px;
}

.reasoning-title.expanded::after {
    content: "▼";
    margin-left: auto;
    font-size: 0.8rem;
}

.reasoning-title:not(.expanded)::after {
    content: "▶";
    margin-left: auto;
    font-size: 0.8rem;
}

/* 思考中的动画点 */
.thinking-dots {
    display: flex;
    align-items: center;
    margin-left: 8px;
}

.thinking-dots span {
    width: 6px;
    height: 6px;
    background-color: #1a73e8;
    border-radius: 50%;
    margin-right: 4px;
    animation: bounce 1.4s infinite ease-in-out;
    opacity: 0.7;
}

.thinking-dots span:nth-child(1) {
    animation-delay: 0s;
}

.thinking-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.thinking-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

.reasoning-content {
    padding: 12px 18px;
    white-space: pre-wrap;
    line-height: 1.5;
}

.faded-text {
    color: #777777;
    font-size: 0.95rem;
}

.ai-message, .user-message {
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 8px;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    min-width: 0; /* 防止文字不换行 */
}

.message-content {
    padding: 14px 18px;
    border-radius: 15px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    line-height: 1.6;
    width: 100%;
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap; /* 保留段落和换行 */
    max-width: 100%;
    overflow: hidden;
}

.message-content p {
    margin-bottom: 12px;
}

.message-content p:last-child {
    margin-bottom: 0;
}

/* 如果文本内有连续两个换行符，显示为段落分隔 */
.message-content br + br {
    margin-top: 0.5em;
    display: block;
    content: "";
}